<?php
namespace app\admin\controller;
use houdunwang\view\View;
use system\model\Admin;

class Login{
	public function index(){
		if(IS_POST){
			$adminModel = (new Admin())->login();
//			p($adminModel);valid    msg
			if($adminModel['valid'])
			{
				//执行成功
				message( $adminModel['msg'], u('admin.entry.index'), $type = 'success', $timeout = 2 );
			}else{
				//执行失败
				message($adminModel['msg'],'back','error');

			}
		}
//		加密测试
//		$encrypted = Crypt::encrypt('admin888');
//		p($encrypted);
		//测试数据库
//		$res = Db::table('admin')->get();
//		p($res);
		//加载模板
		return View::make();
	}

	//验证码类
	public function  code(){
		Code::width(130)->height(40)->num(1)->make();
	}
}



